package com.situ.day250111;
import org.junit.Test;
import java.util.Random;
import java.util.Scanner;

public class MyTest02 {
    @Test
    public void test() {
        Scanner scanner = new Scanner(System.in);
        Random random = new Random();
        int num = random.nextInt(10) + 1;
        System.out.println("num: " + num);
        while (true) {
            System.out.println("猜吧！");
            int guess = scanner.nextInt();
            if (guess == 0) {
                break;
            }

            if (guess < num) {
                System.out.println("太小了");
            } else if (guess > num) {
                System.out.println("太大了");
            } else {
                System.out.println("恭喜你，猜对了");
                break;
            }
        }
    }
}
